//
//  Friends_see.m
//  K-Music
//
//  Created by CHUN on 16/1/15.
//  Copyright © 2016年 CHUN. All rights reserved.
//

#import "Friends_see.h"

@interface Friends_see ()<UITextFieldDelegate>{
    
    UIView*chiosechioseView;
    
    UIButton*OliAction;
    
}


@property(nonatomic,strong)UITextField*searchTF;

@property(nonatomic,assign)BOOL staute;

@end

@implementation Friends_see

-(void)viewWillAppear:(BOOL)animated{
    self.tabBarController.tabBar.hidden = YES;
}
- (void)viewWillDisappear:(BOOL)animated
{
    self.tabBarController.tabBar.hidden = NO;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = RGB(241, 241, 241);
//    self.navigationItem.title = @"查找好友";
    
    self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithIcon:@"back" highIcon:@"back" target:self action:@selector(back_back)];
    
    [self creatUI];
}
- (void)back_back
{
    [self.navigationController popViewControllerAnimated:YES];
}
#pragma mark -- 搜索 --
-(void)creatUI{
    
    UIView*chioseView=[[UIView alloc]init];
    chioseView.frame=CGRectMake(0, 0, WIDTH, 50);
    chioseView.backgroundColor=[UIColor whiteColor];
    [self.view addSubview:chioseView];
    
    UIView*TF=[[UIView alloc]init];
    
    TF.backgroundColor=RGB(238, 238, 238);
    
    TF.frame=CGRectMake(5, 5, WIDTH-60, 40);
    
    TF.layer.masksToBounds=YES;
    TF.layer.borderWidth=2.0F;
    TF.layer.borderColor=[UIColor whiteColor].CGColor;
    [TF.layer setCornerRadius:20];
    
    [chioseView addSubview:TF];
    
    UIButton * SearchAction=[UIButton buttonWithType:UIButtonTypeCustom];
    SearchAction.frame=CGRectMake(TF.frame.origin.x+TF.frame.size.width+2, 5, 50, 40);
    [SearchAction setTitle:@"确定" forState:UIControlStateNormal];
    [SearchAction setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    SearchAction.titleLabel.font=[UIFont systemFontOfSize:14.0f];
    [SearchAction addTarget:self action:@selector(SearchAction) forControlEvents:UIControlEventTouchUpInside];
    [chioseView addSubview:SearchAction];
    
    UIImageView*image=[[UIImageView alloc]init];
    image.frame=CGRectMake(10, 10, 25, 30);
    image.image=[UIImage imageNamed:@"search_i"];
    [TF addSubview:image];
    
    UITextField * searchTF=[[UITextField alloc]initWithFrame:CGRectMake(CGRectGetMaxX(image.frame)+10, 0, WIDTH-120, 40)];
    searchTF.backgroundColor=[UIColor clearColor];
    searchTF.clearButtonMode=UITextFieldViewModeAlways;
    searchTF.keyboardType = UIKeyboardTypeDefault;
    searchTF.returnKeyType =UIReturnKeySearch;
    searchTF.clearsOnBeginEditing = YES;
    searchTF.keyboardAppearance=UIKeyboardAppearanceDefault;
    searchTF.leftViewMode = UITextFieldViewModeAlways;
    NSString * search_Name;
    
    if ([self.navigationItem.title isEqualToString:@"查找好友"]){
        search_Name = @"请输入您要搜索的K歌号";
    }
    if ([self.navigationItem.title isEqualToString:@"搜索群组"]) {
        search_Name = @"请输入您要搜索的群组号";
    }
    
    if ([self.navigationItem.title isEqualToString:@"搜索房间"]) {

        search_Name = @"请输入您要搜索的房号";
    }
    NSLog(@"%@",self.navigationItem.title);
    
    searchTF.text = search_Name;
    [TF addSubview: searchTF];
    
}

/*
 #pragma mark -- 搜索 --
 -(void)search{
 
 UIView*chioseView=[[UIView alloc]init];
 chioseView.frame=CGRectMake(0, 0, WIDTH, 50);
 chioseView.backgroundColor=[UIColor whiteColor];
 [searchView addSubview:chioseView];
 
 UIView*TF=[[UIView alloc]init];
 
 TF.backgroundColor=RGB(238, 238, 238);
 
 TF.frame=CGRectMake(5, 5, WIDTH-60, 40);
 
 TF.layer.masksToBounds=YES;
 TF.layer.borderWidth=2.0F;
 TF.layer.borderColor=[UIColor whiteColor].CGColor;
 [TF.layer setCornerRadius:20];
 
 [chioseView addSubview:TF];
 
 UIButton * SearchAction=[UIButton buttonWithType:UIButtonTypeCustom];
 SearchAction.frame=CGRectMake(TF.frame.origin.x+TF.frame.size.width+2, 5, 50, 40);
 [SearchAction setTitle:@"确定" forState:UIControlStateNormal];
 [SearchAction setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
 SearchAction.titleLabel.font=[UIFont systemFontOfSize:14.0f];
 [SearchAction addTarget:self action:@selector(SearchAction) forControlEvents:UIControlEventTouchUpInside];
 [chioseView addSubview:SearchAction];
 
 UIImageView*image=[[UIImageView alloc]init];
 image.frame=CGRectMake(10, 10, 25, 30);
 image.image=[UIImage imageNamed:@"search_i"];
 [TF addSubview:image];
 
 UITextField * searchTF=[[UITextField alloc]initWithFrame:CGRectMake(CGRectGetMaxX(image.frame)+10, 0, WIDTH-120, 40)];
 searchTF.backgroundColor=[UIColor clearColor];
 searchTF.clearButtonMode=UITextFieldViewModeAlways;
 searchTF.keyboardType = UIKeyboardTypeDefault;
 searchTF.returnKeyType =UIReturnKeySearch;
 searchTF.clearsOnBeginEditing = YES;
 searchTF.keyboardAppearance=UIKeyboardAppearanceDefault;
 searchTF.leftViewMode = UITextFieldViewModeAlways;
 searchTF.text = @"输入K歌号";
 [TF addSubview: searchTF];
 
 }
 */

-(void)SearchAction{
    
    [self.view endEditing:YES];
    
    [MBProgressHUD showErrorWithStatus:@"暂无数据" toView:self.view];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
